package com.qf.week1.day03;

import java.util.Scanner;

public class SumDemo {
    public static void main(String[] args) {
        System.out.println("请用户输入：");
        Scanner sc = new Scanner(System.in);
        int number =sc.nextInt();
        String str = number+"";
        int n = str.length();
        int sum = 0;
        for(int i=0;i<n;i++){
            int tem = (int)Math.pow(10,i);
            int figure = (number/tem)%10;
            sum += figure;
        }
        System.out.print("几位数的和="+sum);
    }


    }

